﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace QYmall.Core.Model.Models
{
    /// <summary>
    /// 订单货品
    /// </summary>
    public class OrderGoods
    {
        [Display(Name = "自增ID")]
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        [Display(Name = "所属订单")]
        [ForeignKey("Order")]
        public long OrderId { get; set; }

        [Display(Name = "所属商品")]
        public long GoodsId { get; set; }

        [Display(Name = "所属货品")]
        public long ProductId { get; set; }

        [Display(Name = "商品编号")]
        [StringLength(128)]
        public string? GoodsNo { get; set; }

        [Display(Name = "商品标题")]
        [StringLength(255)]
        public string? GoodsTitle { get; set; }

        [Display(Name = "规格JSON描述")]
        public string? SkuText { get; set; }

        [Display(Name = "商品图片")]
        [StringLength(512)]
        public string? ImgUrl { get; set; }

        [Display(Name = "商品价格")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal GoodsPrice { get; set; } = 0M;

        [Display(Name = "实际价格")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal RealPrice { get; set; } = 0M;

        [Display(Name = "购买数量")]
        public int Quantity { get; set; } = 1;

        [Display(Name = "重量(克)")]
        public int Weight { get; set; } = 0;

        /// <summary>
        /// 发货状态
        /// 0未发1已发2已退
        /// </summary>
        [Display(Name = "发货状态")]
        public byte DeliveryStatus { get; set; } = 0;

        /// <summary>
        /// 发票发货状态
        /// 0未发1已发2已退
        /// </summary>
        [Display(Name = "发票发货状态")]
        public byte InvoiceStatus { get; set; } = 0;

        /// <summary>
        /// 评价状态
        /// 0未评1已评
        /// </summary>
        [Display(Name = "评价状态")]
        public byte EvaluateStatus { get; set; } = 0;

        /// <summary>
        /// 订单信息
        /// </summary>
        public Orders? Order { get; set; }
    }
}
